Skip to content

Add opt-in durable startup handoff - #549

Open
JusterZhu wants to merge 1 commit into
justerzhu-startup-health-integrationfrom
justerzhu-persistent-attempt-handoff
Open

JusterZhu wants to merge 1 commit into
justerzhu-startup-health-integrationfrom
justerzhu-persistent-attempt-handoff

Conversation

@JusterZhu

@JusterZhu JusterZhu commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add a caller-selected durable attempt ID and an opt-in handoff that claims one process launch before using the existing readiness adapter. Restart recovery reads persisted status without guessing whether a claimed launch occurred.
  • Keep existing updater, reporting and rollback behavior unchanged. Explicit business readiness alone can confirm health; an ambiguous launch is never retried automatically.
  • Document the rollback ownership boundary and exercise the handoff in the existing Windows Native AOT workflow.

Validation

  • dotnet test tests\CoreTest\CoreTest.csproj --filter "FullyQualifiedName~StartupHealth" — 25 passed, including real child processes, competing launchers, killed host recovery, incomplete state, timeout and disabled behavior.
  • dotnet build src\GeneralUpdate.Core\GeneralUpdate.Core.csproj --no-restore — all target frameworks built.
  • Published framework-dependent Windows apphost exercised the handoff and explicit readiness successfully.
  • Windows Native AOT CI run 45043712311 passed native publish and the handoff/readiness child-process scenario. Local AOT publish was blocked by the missing Windows C++ linker.

Boundaries

Based on #546 at 59af7951458727e128b440cab8a82eef0500dec2. No integration or combined validation was performed with Bowl.Host, #541 (623a87ce5112af0dab4d23c457797d23cd419143), or #543 (ad77b50c5125a436ab4d4c8a894f6df7235d95b0). Their file-application/process-alive outcomes are not business health.

Core AbstractStrategy restores on certain application failures, while legacy BowlBootstrap can separately restore after a captured crash when configured; a single owner across deployment paths is not established. This PR adds no restore. A host-owned durable update journal, exact snapshot association, process fencing, coordinated single rollback ownership, idempotent restoration and reporting remain future layers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The launcher tests can intermittently read an empty PID file before writing completes, causing failures and leaving the waiting child process running.

1 open issue
What changed in this PR

Adds an opt-in durable handoff around the existing startup-readiness adapter, allowing cooperating hosts to claim one launch and recover persisted health status without retrying ambiguous launches. Existing updater, reporting, and rollback behavior remains unchanged.

Changes:

  • Adds caller-selected attempt IDs and exclusive creation and launch claims.
  • Covers launch competition, interrupted state, restart recovery, and explicit readiness with process tests and Windows Native AOT coverage.
  • Documents recovery constraints and host-owned rollback responsibilities.
File Description
tests/​StartupHealthProbe/​Program.cs Adds handoff host modes and a native readiness scenario.
tests/​CoreTest/​StartupHealth/​StartupHealthHandoffTests.cs Tests launch claims, recovery, failures, and readiness.
src/​GeneralUpdate.Core/​StartupHealth/​StartupHealthStore.cs Adds caller-selected IDs with exclusive creation claims.
src/​GeneralUpdate.Core/​StartupHealth/​StartupHealthHandoff.cs Introduces opt-in launch claiming and status observation.
docs/​startup-health-store.md Explains handoff usage, durability limits, and rollback boundaries.
.github/​workflows/​startup-health-aot.yml Exercises the handoff in Windows Native AOT CI.

Review effort: Balanced

start.ArgumentList.Add(args[4]);
start.ArgumentList.Add("wait");
using var child = handoff.Start(handoffId, start);
File.WriteAllText(args[3], child.Id.ToString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants